//
//  IManager+ModuleFeedback.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-6-24.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleFeedback.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "RCFeedbackDataModel.h"
#import "GloableEngineService.h"

@implementation IManager(ModuleFeedback)

-(int64_t)requestFeedback:(NSString *)content withPhone:(NSString *)phone withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:content]) {
        return kInvalidRequestId;
    }
    if (nil == phone) {
        phone = @"";
    }
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    NSString *bduss = [[GloableEngineService sharedInstance] bduss];
//    if (![NSString stringIsNullOrEmpty:bduss]) {
        [postValue setObject:bduss forKey:@"bduss" withDefaultValue:@""];
//    }
    [postValue setObject:content forKey:@"content" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"phone" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"mobile" withDefaultValue:@""];

    // 异步获取数据
    NSString *urlSuffix = kRCFeedbackUrlPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

@end
